﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HappyWorks.Pattern.Creational.SimpleFactory
{
    public interface IProduct { }
    public class ProductA:IProduct
    { }

    public class ProductB:IProduct
    { }

    public class SimpleFactory
    {
        public IProduct CreateProduct(string  type)
        {
            IProduct product;
            switch (type.ToUpper())
            { 
                case "A":
                    product = new ProductA();
                    break;
                case "B":
                    product = new ProductB();
                    break;
                default:
                    product = new ProductA();
                    break;
            }
            return product;
        }
    }

}
